package com.pengxun.mall.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.pengxun.mall.dto.ChangeOrderGoodsDTO;
import com.pengxun.mall.dto.OrderDTO;
import com.pengxun.mall.dto.OrderReportDTO;
import com.pengxun.mall.dto.SearchOrderDTO;
import com.pengxun.mall.dto.UpdateOrderDTO;
import com.pengxun.mall.service.OrderService;
import com.szeastroc.common.result.Result;
import com.szeastroc.common.result.ResultUtils;

@RestController
public class OrderController {

	@Resource
	private OrderService orderService;
	
	@RequestMapping("/createOrder")
	public Result<Object> createOrder(@RequestBody OrderDTO orderDTO){
		orderService.createOrder(orderDTO);
		return ResultUtils.render();
	} 
	
	@RequestMapping("/getOrders")
	public Result<Object> getOrders(@RequestBody SearchOrderDTO searchOrderDTO){
		return ResultUtils.render(orderService.getOrders(searchOrderDTO));
	} 
	
	@RequestMapping("/getOrderDetail")
	public Result<Object> getOrderDetail(String orderNum){
		return ResultUtils.render(orderService.getOrderDetail(orderNum));
	} 
	
	@RequestMapping("/updateOrder")
	public Result<Object> updateOrder(@RequestBody UpdateOrderDTO updateOrderDTO){
		orderService.updateOrder(updateOrderDTO);
		return ResultUtils.render();
	} 
	
	@RequestMapping("/changeOrderGoods")
	public Result<Object> changeOrderGoods(@RequestBody ChangeOrderGoodsDTO changeOrderGoodsDTO){
		orderService.changeOrderGoods(changeOrderGoodsDTO);
		return ResultUtils.render();
	}
	
	
	@RequestMapping("/getOrderReport")
	public Result<Object> getOrderReport(@RequestBody OrderReportDTO orderReportDTO){
		return ResultUtils.render(orderService.getOrderReport(orderReportDTO));
	}
	
	
	
}
